import { onMounted, reactive } from 'vue'
import axios from 'axios'


export default function () {
    
    let dogList = reactive([
        'https://images.dog.ceo/breeds/redbone/n02090379_980.jpg'
    ])
    
    async function getDog() {
        try {
            let res = await axios.get('https://dog.ceo/api/breeds/image/random')
            console.log(res.data)
            dogList.push(res.data.message)
        } catch (error) {
            console.log(error)
            alert(error)
        }
        
    }    

    // SPA  single page web application  
    return {
        dogList,
        getDog
    }
}


